class sensor_nclosest_radar(object):
	"""This sensor supplies an agent with a list of at most N agents within a certain radius, giving a relative heading and a magnitude to those agents.  If there are not N that are within the radius, it will return the maximum distance and 0 as a heading."""
	def __init__(self, agent_num, world_model, num_agents=1,max_range=1e1000,mode=0):
		self.agent_num=agent_num
		self.max_range=max_range
		self.world_model=world_model
		self.num_agents=num_agents
		self.default_agent_pos=[0,max_range]
		self.mode=mode
	def sense(self):
		in_range=filter(lambda x: x[1] <= self.max_range,self.world_model.rel_object_locations(self.agent_num,self.mode))
		in_range.sort(lambda x,y: int(x[1]-y[1]))
		in_range.extend([self.default_agent_pos]*self.num_agents)
		return in_range[0:self.num_agents]
